// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  app: {
    head: {
      title: '神秘客网点', // 默认备用标题
      htmlAttrs: {
        lang: 'zh-cn'
      },
      link: [
        { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
      ],
      meta: [
        {
          name: 'keywords',
          content: ''
        },
        { name: 'description', content: '' }
      ]
    },
    pageTransition: { name: 'page', mode: 'out-in' }
  },
  ssr: true,
  target: 'server',
  devtools: { enabled: true },
  modules: ['@element-plus/nuxt', '@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt','@hypernym/nuxt-gsap'],
  gsap: {
    extraPlugins: {
      scrollTrigger: true, // 启用 ScrollTrigger 插件
    },
  },
  piniaPersistedstate: {
    cookieOptions: {
      maxAge: 2 * 365 * 24 * 60 * 60 * 1000
    },
    storage: 'localStorage'
  },
  css: ['~/assets/css/tailwind.css', '~/assets/iconfont/iconfont.css'],
  //
  plugins: ['~/plugins/el-icon', '~/plugins/reset',
    {
      src: '~/plugins/weiqianduan',
      mode: 'client'
    },
    {
      src: '~/plugins/err-global',
    }
  ],
  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {}
    }
  },
  devServer: {
    port: 3093
  },
  server: {
    port: 3093,
    host: '0.0.0.0',
    timing: false
  },
  build: {
    transpile: [/echarts/]
  },
  nitro: {
    devProxy: {
      '/api': {
        target: 'http://129.211.212.235:8097',
        changeOrigin: true, // 允许跨域
        secure: false, // 禁用 HTTPS 校验

      }
    }
  },
  runtimeConfig: {
    public: {
      apiBase: '/api' // 客户端统一使用的 API 前缀
    }
  }
})
